<?php namespace Home\Controller; 


//支付页面控制器
class PayController extends CommonController{

	public function __init(){
			parent::__init();
	}
    //动作
    public function index(){
//  	获取订单数据
//		p($_GET);die;
		$orderData = Db::table('snshop_order')
						-> where('oid',Q('get.oid',0,'intval'))
						-> first();
		$orderData['time'] = date('Y-m-d H:i:s',$orderData['time']);
		View::with('orderData',$orderData);
//		p($orderData);die;
		
//		设定一个空数组，来接受订单列表
		$orderListData = array(); 
		foreach(Q('get.olid',array()) as $k => $v){
			$orderListData[$k] = Db::table('snshop_order_list')
							-> where('olid',$v)
							-> first();
//			查询商品表，然后将单价，商品名字压入
//			name
			$orderListData[$k]['name'] = Db::table('snshop_goods')		
									-> where('gid',$orderListData[$k]['snshop_goods_gid'])
									-> pluck('gname');
//			单价
			$orderListData[$k]['price'] = Db::table('snshop_goods')		
									-> where('gid',$orderListData[$k]['snshop_goods_gid'])
									-> pluck('shopprice');
//			列表图
			$orderListData[$k]['pic'] = Db::table('snshop_goods')		
									-> where('gid',$orderListData[$k]['snshop_goods_gid'])
									-> pluck('pic');
			
			
		}
//		p($orderListData);die;
		View::with('orderListData',$orderListData);
		
    	View::make();
    }
}
